home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 2.toast / pc / sample code / quicktime / basics / mfc mdiplayer.win / mfcmdiplayer.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-28  |  4.5 KB  |  169 lines

  1. // MFCMDIPlayer.cpp : Defines the class behaviors for the application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "MFCMDIPlayer.h"
  6.  
  7. #include "MainFrm.h"
  8. #include "ChildFrm.h"
  9. #include "MFCMDIPlayerDoc.h"
  10. #include "MFCMDIPlayerView.h"
  11.  
  12. #ifdef _DEBUG
  13. #define new DEBUG_NEW
  14. #undef THIS_FILE
  15. static char THIS_FILE[] = __FILE__;
  16. #endif
  17.  
  18. /////////////////////////////////////////////////////////////////////////////
  19. // CMFCMDIPlayerApp
  20.  
  21. BEGIN_MESSAGE_MAP(CMFCMDIPlayerApp, CWinApp)
  22.     //{{AFX_MSG_MAP(CMFCMDIPlayerApp)
  23.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  24.         // NOTE - the ClassWizard will add and remove mapping macros here.
  25.         //    DO NOT EDIT what you see in these blocks of generated code!
  26.     //}}AFX_MSG_MAP
  27.     // Standard file based document commands
  28.     ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  29.     ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  30.     // Standard print setup command
  31.     ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
  32. END_MESSAGE_MAP()
  33.  
  34. /////////////////////////////////////////////////////////////////////////////
  35. // CMFCMDIPlayerApp construction
  36.  
  37. CMFCMDIPlayerApp::CMFCMDIPlayerApp()
  38. {
  39.     // TODO: add construction code here,
  40.     // Place all significant initialization in InitInstance
  41. }
  42.  
  43. /////////////////////////////////////////////////////////////////////////////
  44. // The one and only CMFCMDIPlayerApp object
  45.  
  46. CMFCMDIPlayerApp theApp;
  47.  
  48. /////////////////////////////////////////////////////////////////////////////
  49. // CMFCMDIPlayerApp initialization
  50.  
  51. BOOL CMFCMDIPlayerApp::InitInstance()
  52. {
  53.     // Standard initialization
  54.     // If you are not using these features and wish to reduce the size
  55.     //  of your final executable, you should remove from the following
  56.     //  the specific initialization routines you do not need.
  57.     
  58.     // Initialize QTML and QuickTime
  59.     InitializeQTML(0);
  60.     EnterMovies();
  61.  
  62. #ifdef _AFXDLL
  63.     Enable3dControls();            // Call this when using MFC in a shared DLL
  64. #else
  65.     Enable3dControlsStatic();    // Call this when linking to MFC statically
  66. #endif
  67.  
  68.     LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  69.  
  70.     // Register the application's document templates.  Document templates
  71.     //  serve as the connection between documents, frame windows and views.
  72.  
  73.     CMultiDocTemplate* pDocTemplate;
  74.     pDocTemplate = new CMultiDocTemplate(
  75.         IDR_MFCMDITYPE,
  76.         RUNTIME_CLASS(CMFCMDIPlayerDoc),
  77.         RUNTIME_CLASS(CChildFrame), // custom MDI child frame
  78.         RUNTIME_CLASS(CMFCMDIPlayerView));
  79.     AddDocTemplate(pDocTemplate);
  80.  
  81.     // create main MDI Frame window
  82.     CMainFrame* pMainFrame = new CMainFrame;
  83.     if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
  84.         return FALSE;
  85.     m_pMainWnd = pMainFrame;
  86.  
  87.     // Parse command line for standard shell commands, DDE, file open
  88.     CCommandLineInfo cmdInfo;
  89.  
  90.     // DON'T display a new MDI child window during startup!!!
  91.     cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
  92.  
  93.     ParseCommandLine(cmdInfo);
  94.  
  95.     // Dispatch commands specified on the command line
  96.     if (!ProcessShellCommand(cmdInfo))
  97.         return FALSE;
  98.  
  99.     // The main window has been initialized, so show and update it.
  100.     pMainFrame->ShowWindow(m_nCmdShow);
  101.     pMainFrame->UpdateWindow();
  102.  
  103.     return TRUE;
  104. }
  105.  
  106. /////////////////////////////////////////////////////////////////////////////
  107. // CAboutDlg dialog used for App About
  108.  
  109. class CAboutDlg : public CDialog
  110. {
  111. public:
  112.     CAboutDlg();
  113.  
  114. // Dialog Data
  115.     //{{AFX_DATA(CAboutDlg)
  116.     enum { IDD = IDD_ABOUTBOX };
  117.     //}}AFX_DATA
  118.  
  119.     // ClassWizard generated virtual function overrides
  120.     //{{AFX_VIRTUAL(CAboutDlg)
  121.     protected:
  122.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  123.     //}}AFX_VIRTUAL
  124.  
  125. // Implementation
  126. protected:
  127.     //{{AFX_MSG(CAboutDlg)
  128.         // No message handlers
  129.     //}}AFX_MSG
  130.     DECLARE_MESSAGE_MAP()
  131. };
  132.  
  133. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  134. {
  135.     //{{AFX_DATA_INIT(CAboutDlg)
  136.     //}}AFX_DATA_INIT
  137. }
  138.  
  139. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  140. {
  141.     CDialog::DoDataExchange(pDX);
  142.     //{{AFX_DATA_MAP(CAboutDlg)
  143.     //}}AFX_DATA_MAP
  144. }
  145.  
  146. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  147.     //{{AFX_MSG_MAP(CAboutDlg)
  148.         // No message handlers
  149.     //}}AFX_MSG_MAP
  150. END_MESSAGE_MAP()
  151.  
  152. // App command to run the dialog
  153. void CMFCMDIPlayerApp::OnAppAbout()
  154. {
  155.     CAboutDlg aboutDlg;
  156.     aboutDlg.DoModal();
  157. }
  158.  
  159. /////////////////////////////////////////////////////////////////////////////
  160. // CMFCMDIPlayerApp commands
  161.  
  162. int CMFCMDIPlayerApp::ExitInstance() 
  163. {
  164.     // TODO: Add your specialized code here and/or call the base class
  165.     ExitMovies();
  166.     TerminateQTML();
  167.     return CWinApp::ExitInstance();
  168. }
  169.